<template lang="">
  <div class="study-center-box">
    <div class="study-navbar">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane v-if="menuList.includes('courseAudit')" name="courseAudit">
          <span slot="label" class="tabPaneStyle"><i style="font-size:19px;" class="iconfont iconweibiaoti--"></i> 开课审批</span>
          <div v-if="activeName == 'courseAudit'">
            <course-audit :activeName="activeName"></course-audit>
          </div>
        </el-tab-pane>
        <el-tab-pane v-if="menuList.includes('courseCompleteAudit')" name="courseCompleteAudit">
          <span slot="label" class="tabPaneStyle"><i style="font-size:19px;" class="iconfont iconwenti-shuben"></i> 授课完毕审批</span>
          <div v-if="activeName == 'courseCompleteAudit'">
            <course-complete-audit :activeName="activeName"></course-complete-audit>
          </div>
        </el-tab-pane>
        <el-tab-pane  v-if="menuList.includes('teacherMaintain')" name="teacherMaintain">
          <span slot="label" class="tabPaneStyle"><i style="font-size:19px;" class="iconfont iconlianxiren"></i> 讲师维护</span>
          <div v-if="activeName == 'teacherMaintain'">
            <teacher-maintain :activeName="activeName"></teacher-maintain>
          </div>
        </el-tab-pane>
        <el-tab-pane v-if="menuList.includes('courseMaintain')" name="courseMaintain">
          <span slot="label" class="tabPaneStyle"><i class="iconfont iconjixiaokaoping"></i> 课程维护</span>
          <div v-if="activeName == 'courseMaintain'">
            <course-maintain :activeName="activeName"></course-maintain>
          </div>
        </el-tab-pane>
        <el-tab-pane v-if="menuList.includes('planMaintainTab')" name="planMaintainTab">
          <span slot="label" class="tabPaneStyle"><i class="iconfont iconxinfeng2"></i> 培训计划</span>
          <div v-if="activeName == 'planMaintainTab'">
            <plan-maintain-tab :activeName="activeName"></plan-maintain-tab>
          </div>
        </el-tab-pane>
        <el-tab-pane v-if="menuList.includes('teacherStudentTab')" name="courseAssess">
          <span slot="label" class="tabPaneStyle"><i style="font-size:21px;" class="iconfont iconrenshu"></i> 导师带徒评价</span>
          <div v-if="activeName == 'courseAssess'">
            <course-assess :activeName="activeName"></course-assess>
          </div>
        </el-tab-pane>
      </el-tabs>
      <div class="login-info-box flex-row">
          <div class="picture">
            <img src="@/assets/homePicture/userpicture.png">
          </div>
          <div class="login-info">
              <p>欢迎您，{{username}}</p>
          </div>
      </div>
    </div>
  </div>
</template>
<script>
import courseAudit from "@/pages/studyCenter/studyModal/classApply"; // 开课审批
import courseCompleteAudit from "@/pages/studyCenter/studyModal/classFinish"; // 授课完毕
import teacherMaintain from "@/pages/studyCenter/studyModal/teacher"; // 讲师维护
import courseMaintain from "@/pages/studyCenter/studyModal/classRepair"; // 课程维护
import planMaintainTab from "@/pages/studyCenter/studyModal/plan"; // 培训计划
import courseAssess from "@/pages/studyCenter/studyModal/courseAssess"; // 课程评价
export default {
  components: {
    courseAudit,
    courseCompleteAudit,
    teacherMaintain,
    courseMaintain,
    planMaintainTab,
    courseAssess
  },
  data() {
    return {
      username:'',
      activeName: "planMaintainTab",
      menuList:[],
      studyList:['courseAudit','courseCompleteAudit','teacherMaintain','courseMaintain','planMaintainTab', 'courseAssess']
    };
  },
  mounted() {
    let menuList = localStorage.getItem("menuList");
    let initMenuList = JSON.parse(menuList);
    let studyList = this.studyList;
    this.menuList = initMenuList.permissions.tabPages;
    let studyListObj = initMenuList.permissions.tabPages;
    let realStudyList = studyList.filter(item=>studyListObj.indexOf(item)>-1);
    this.activeName = realStudyList[0];
    this.username = initMenuList.username;
    console.log(realStudyList)
  },
  watch: {
    activeName(oldVal, newVal) {}
  },
  methods: {
    handleClick() {}
  }
};
</script>
<style lang="less" scoped>
// @import url("~@/pagecss/studyCenter");
.is-active,
.study-center-box {
  background-color: #fff !important;
}
.study-center-box {
  padding: 0 15px;
}
.picture {
  width: 25px;
  height: 25px;
  margin-right: 10px;
  border-radius: 50%;
  background-color: antiquewhite;
}
.login-info {
  p {
    line-height: 15px;
    font-size: 13px;
    font-weight: 300;
    color: rgba(102, 102, 102, 1);
  }
}
.login-info-box {
  position: absolute;
  top: 3px;
  right: 15px;
}
</style>
